package com.wp.common.vo;

import lombok.Data;

import java.util.List;

/**
 * 分页结果封装
 *
 * @author wp
 * @create 2019-03-03 11:45
 */
@Data
public class PageResult<T> {
    /**
     * 当前页码
     */
    private Integer pageNum;
    /**
     * 每页数量
     */
    private Integer pageSize;
    /**
     * 记录总数
     */
    private Long totalSize;
    /**
     * 页码总数
     */
    private Integer totalPages;
    /**
     * 数据
     */
    private List<T> content;

    public PageResult(Long total, List<T> items) {
        this.totalSize = total;
        this.content = items;
    }

    public PageResult(Long total, Integer totalPage, List<T> items) {
        this.totalSize = total;
        this.totalPages = totalPage;
        this.content = items;
    }

    public PageResult(Integer pageNum, Integer pageSize, Long totalSize, Integer totalPages, List<T> content) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.totalSize = totalSize;
        this.totalPages = totalPages;
        this.content = content;
    }
}
